﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Videos.ascx.cs" Inherits="Sites_ThanhDuy_Webparts_Common_Videos" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<%@ Import Namespace="NTTHAO.Web.BL.CommonPage" %>
<%
if (_Menu != null)
{ %>
<h1 style="display: none;"><%=Server.HtmlEncode(_Menu.Text)%></h1>
<div class="video-list"><%
    if (_List != null)
    {
        string imagePath = "/" + Constant.UPLOAD_FILE_PATH + "commonpage/";
        for (int i = 0; i < _List.Rows.Count; i++)
        {
            DataRow row = _List.Rows[i];
            
            int id = (int)row[CommonPageContent.ID__COLUMN_NAME];
            int menuID = (int)row[CommonPageContent.MENUID__COLUMN_NAME];
            string menuPath = row["MenuPath"].ToString() + CommonMenu.MENUPATH_SEPARATOR + menuID.ToString();
            string header = row[CommonPageContent.HEADER__COLUMN_NAME].ToString();
            string image = row[CommonPageContent.MINIIMAGE__COLUMN_NAME].ToString();
            string description = row[CommonPageContent.DESCRIPTION__COLUMN_NAME].ToString();
            string urlHeader = row[CommonPageContent.URLHEADER__COLUMN_NAME].ToString();
            string date = ((DateTime)row[CommonPageContent.INSERTDATE__COLUMN_NAME]).ToString("dd/MM/yyyy");
            string href = this.GetURL(menuPath, id, urlHeader);
%>
    <div class="item"><%if (image.Length > 0) { %>
        <div class="img">
            <a href="<%=href %>"><img src="<%=imagePath + image %>" alt="<%=header.Replace("\"", "'") %>" title="<%=header.Replace("\"", "'") %>" /></a>
        </div><%} %>
        <div class="info">
            <h3><a href="<%=href %>"><%=Server.HtmlEncode(header) %></a></h3>
            <div class="date">Ngày đăng: <span><%=date %></span></div>
        </div>
    </div><%
        }
    }
%>
</div><%
          if (_PageCount > 0 && _TotalItem > 0) 
{ %>
<div class="boxPaging oh">
    <div class="pagenum">
        <ul>
            <li><a class="first" href="<%=this._BaseURL + "page/1/" %>">&nbsp;&nbsp;</a></li>
            <li><a class="pre" href="<%=this._BaseURL + "page/" + (this._PageNo <= 1 ? 1 : (this._PageNo - 1)) + "/" %>">&nbsp;&nbsp;</a></li>
            <%
                int startPage = _PageNo - 4;
                if (startPage > _PageCount - 9)
                {
                    startPage = _PageCount - 9;
                }
                if (startPage < 1)
                {
                    startPage = 1;
                }
                for (int i = startPage; i <= _PageCount && i < (startPage + 10); i++) 
                {
            %>
            <li <%=(i == _PageNo ? "class=\"selected\"" : "") %>><a href="<%=this._BaseURL + "page/" + i.ToString() + "/" %>"><%=i %></a></li>
            <%   
                }
            %>
            <li><a class="next" href="<%=this._BaseURL + "page/" + (this._PageNo >= this._PageCount ? this._PageCount : (this._PageNo + 1)) + "/" %>">&nbsp;&nbsp;</a></li>
            <li><a class="last" href="<%=this._BaseURL + "page/" + this._PageCount.ToString() + "/" %>">&nbsp;&nbsp;</a></li>
        </ul>
    </div>
</div>
<%
    } %>
<%
} %>